package ui;

import FilesystemObject;

import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;

import model.FilesystemTreeModel;

/**
 * UI component for this file system browser project.
 * 
 * @author Chris Moghbel (cmoghbel@ucsd.edu)
 */
@SuppressWarnings("serial")
public class ViewComponent extends JFrame {

  public ViewComponent () {
    JTree tree = new JTree();
    FilesystemObject root = new FilesystemNode(".");
    tree.setModel(new FilesystemTreeModel(root));
    tree.setShowsRootHandles(true);
    JScrollPane scrollPane = new JScrollPane(tree);
    scrollPane.setPreferredSize(new Dimension(1024, 720));
    this.add(scrollPane);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.pack();
    this.setVisible(true);
  }

  /**
   * Entry point for the application.
   * 
   * @param args command line arguments
   */
  public static void main (String[] args) {
    new ViewComponent();
  }
}
